<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>用户登录</title>
<jsp:include page="WEB-INF/page/include/include.jsp"></jsp:include>

</head>
<body>
	<div class="top-content">
		<div class="inner-bg">
			<div class="container">
				<div class="row">
					<div class="col-md-4 col-md-offset-4 text">
						<h1>
							<strong>用户登录</strong>Login Form
						</h1>
					</div>
				</div>
				<div class="row">
					<div class="col-md-6 col-md-offset-3">
						<div class="form-top">
							<h3>Login to our site</h3>
							<p>Enter your username and password to log on:</p>
						</div>
						<div class="form-bottom">
							<form>
								<div class="form-group">
									<input type="email" class="form-control" id="loginName" name="loginName"
										placeholder="手机/邮箱/用户名">
								</div>
								<div class="form-group">
									<input type="password" class="form-control" id="loginPwd" name="loginPwd"
										placeholder="密码">
								</div>
							</form>
							<button id="loginButton" type="button" class="btn btn-danger"
								style="width: 100%">登 录</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<script type="text/javascript">
		$(function() {
			$("#loginButton").on("click", function() {
				var form = $("form").serialize();
				$.ajax({
					url : "puffer/login",
					data : form,
					type : "POST",
					success : function(msg) {
						if (msg == "success") {
							window.location.href = "puffer/FrameAll";
						} else {
							$("#loginName").val("");
							alert("用户名或密码错误！");
						}
					}
				});
			});
		})

		$(function() {
			document.onkeydown = function(e) {
				var ev = document.all ? window.event : e;
				if (ev.keyCode == 13) {// 如（ev.ctrlKey && ev.keyCode==13）为ctrl+Center 触发
					$("#loginButton").click();
				}
			}
		})
	</script>
</body>
</html>
